package com.zx.centers.dataservice.mybatis.mapper.centers;

import com.zx.centers.dataservice.mybatis.domain.centers.SysDictType;
import org.apache.ibatis.jdbc.SQL;

public class SysDictTypeSqlProvider {

    public String insertSelective(SysDictType record) {
        SQL sql = new SQL();
        sql.INSERT_INTO("sys_dict_type");
        
        if (record.getId() != null) {
            sql.VALUES("id", "#{id,jdbcType=BIGINT}");
        }
        
        if (record.getDictCode() != null) {
            sql.VALUES("dict_code", "#{dictCode,jdbcType=VARCHAR}");
        }
        
        if (record.getDictName() != null) {
            sql.VALUES("dict_name", "#{dictName,jdbcType=VARCHAR}");
        }
        
        if (record.getCreateTime() != null) {
            sql.VALUES("create_time", "#{createTime,jdbcType=TIMESTAMP}");
        }
        
        if (record.getUpdateTime() != null) {
            sql.VALUES("update_time", "#{updateTime,jdbcType=TIMESTAMP}");
        }
        
        if (record.getDictValue() != null) {
            sql.VALUES("dict_value", "#{dictValue,jdbcType=VARCHAR}");
        }
        
        if (record.getRemark() != null) {
            sql.VALUES("remark", "#{remark,jdbcType=VARCHAR}");
        }
        
        return sql.toString();
    }

    public String updateByPrimaryKeySelective(SysDictType record) {
        SQL sql = new SQL();
        sql.UPDATE("sys_dict_type");
        
        if (record.getDictCode() != null) {
            sql.SET("dict_code = #{dictCode,jdbcType=VARCHAR}");
        }
        
        if (record.getDictName() != null) {
            sql.SET("dict_name = #{dictName,jdbcType=VARCHAR}");
        }
        
        if (record.getCreateTime() != null) {
            sql.SET("create_time = #{createTime,jdbcType=TIMESTAMP}");
        }
        
        if (record.getUpdateTime() != null) {
            sql.SET("update_time = #{updateTime,jdbcType=TIMESTAMP}");
        }
        
        if (record.getDictValue() != null) {
            sql.SET("dict_value = #{dictValue,jdbcType=VARCHAR}");
        }
        
        if (record.getRemark() != null) {
            sql.SET("remark = #{remark,jdbcType=VARCHAR}");
        }
        
        sql.WHERE("id = #{id,jdbcType=BIGINT}");
        
        return sql.toString();
    }
}